package cn.edu.besti.is.threescreens;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;


public class MainActivity extends Activity implements View.OnTouchListener {

    @SuppressLint("ClickableViewAccessibility")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TextView tv1 = findViewById(R.id.textView1);
        tv1.setOnTouchListener(this);
        TextView tv2 = findViewById(R.id.textView2);
        tv2.setOnTouchListener(this);
    }

    @SuppressLint("ClickableViewAccessibility")
    @Override
    public boolean onTouch(View arg0, MotionEvent event) {
        if (arg0.getId()==(R.id.textView1)){
            Intent intent = new Intent(this, SecondActivity.class);
            startActivity(intent);
        }
        if (arg0.getId()==(R.id.textView2)){
            Intent intent = new Intent(this, ThirdActivity.class);
            startActivity(intent);
        }
        return true;
    }
}
